/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controllers;

import app.AreaType;
import app.AreasOfStudyType;
import app.DocumentType;
import app.ObjectFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

/**
 *
 * @author Spyros
 */
public class TestJAXBController {

    private ObjectFactory objectFactory;
    private DocumentType documentType;

    public TestJAXBController() {
        objectFactory = new ObjectFactory();
        documentType = objectFactory.createDocumentType();
    }

    public void execute() {
        setValues();
        marshal();
    }

    private void setValues() {
        AreasOfStudyType areasOfStudyType = objectFactory.createAreasOfStudyType();
        AreaType areaType = objectFactory.createAreaType();
//        areaType.set
    }

    public void marshal() {
        try {
            JAXBElement<DocumentType> gl = objectFactory.createDocument(documentType);
            JAXBContext jc = JAXBContext.newInstance("app");
            Marshaller m = jc.createMarshaller();
            m.marshal(gl, System.out);
        } catch (JAXBException jbe) {
            System.out.println(jbe.toString());
        }
    }
}
